using UnityEngine;
using System.Collections;

/// \class  gkAbyssalGiantFishDistanceConstraint
/// \brief  Constraint the fish to not get to fatr behind
[AddComponentMenu("GK/AbyssalGiant/GantFish/gkAbyssalGiantFishDistanceConstraint")]
public class gkAbyssalGiantFishDistanceConstraint : MonoBehaviour
{
	/// The Minimum abscisse
	private float m_fMinimumAbscisse;
	
	/// \brief  Called just after the game begin to play
    void Start()
    {
		// Save the current abscisse as the minimum abscisse 
        m_fMinimumAbscisse = transform.position.x;
    }
	
	/// \brief  Update is called once per frame
	void LateUpdate()
	{
		Vector3 f3Position;
		
		f3Position = transform.position;
		if(f3Position.x < m_fMinimumAbscisse)
		{
			f3Position.x = m_fMinimumAbscisse;
			transform.position = f3Position;
		}
	}
}